﻿@using Blazorise.Extensions

@if ( !RouterTabsService.Tabs.IsNullOrEmpty() )
{
    <Tabs @bind-SelectedTab=@RouterTabsService.SelectedRouterTab>
        <Items>
            @foreach ( var routerTab in RouterTabsService.Tabs )
            {
                var name = GetTabName( routerTab );

                <Tab @key="@name" Name="@name" Class="@routerTab.TabClass">
                    @name
                    @if ( routerTab.Closeable )
                    {
                        <CloseButton AutoClose=false Clicked="@(() => CloseTab(routerTab))" Margin="Margin.Is2.FromStart" />
                    }
                </Tab>
            }
        </Items>
        <Content>
            @foreach ( var routerTab in RouterTabsService.Tabs )
            {
                var name = GetTabName( routerTab );

                <TabPanel @key="@name" Name="@name" Class="@routerTab.TabPanelClass">
                    @routerTab.Body
                </TabPanel>
            }
        </Content>
    </Tabs>
}

